package com.cqupt.tr.edgenode.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class ObjectJsonTransFunction {

    public  static String toJsonStr(Object object){
        return JSONObject.toJSONStringWithDateFormat(object,"yyyy-MM-dd HH:mm:ss",
                SerializerFeature.WriteDateUseDateFormat, SerializerFeature.WriteMapNullValue);
        //return JSONObject.toJSONString(object, SerializerFeature.WriteMapNullValue);
    }
    public static <T> T toObject(String jsonMsg,Class<T> clasz){
        T t= (T) JSON.parseObject(jsonMsg,clasz);
        return t;
    }

}
